{% include 'front/header.html' %}
<!--<script type="text/javascript" src="/resource/front/css/mobile/size.js"></script>-->
<style>
	html,
	body {
		height: 100%;
	}
	
	.content {
		height: 100% !important;
	}
	
	.header-con {
		height: 1.466666rem;
		background: url("/resource/front/images/forward/hearder-img.png");
		color: #fff;
		display: flex !important;
		flex-flow: row;
		justify-content: space-around;
		color: #fff !important;
		align-items: center;
	}
	
	.mui-table-view-cell.mui-collapse.mui-active {
		margin-top: 0;
	}
	
	.mui-card {
		margin: 0;
		border-radius: 0;
		box-shadow: none !important;
	}
	
	.mui-collapse {
		border-radius: 0 !important;
	}
	
	.mui-collapse-content {
		background: transparent !important;
		padding: 0 !important;
	}
	
	.mui-table-view-cell:after {
		background: transparent !important;
	}
	
	.tx-info {
		font-size: 0.346666rem;
		color: #666;
		padding: 0.36rem 0 0.36rem 0.453333rem
	}
	
	.tx-list:last-child {
		margin-bottom: 0 !important;
	}
	
	.tx-list-item {
		width: 100%;
		padding: 0.573333rem 0 0.6rem 0.453333rem;
		background: #fff;
		font-size: 0.346666rem;
		margin-bottom: 0.053333rem;
	}
	
	.tx-list-item span {
		display: inline-block;
	}
	
	.time,
	.money {
		color: #333;
	}
	
	.money {
		margin-left: 1.493333rem;
	}
	
	.getmoney {
		margin-left: .873333rem;
		color: #b5b5b5;
	}
	
	.error-m {
		color: #f85b5d;
	}
	.mui-navigate-right:after, .mui-push-left:after, .mui-push-right:after{
		color: #fff !important;
	}
</style>
<script>
	if(!document.querySelector('.dataTables_processing')) {
		var div = document.createElement("div");
		var msg = '';
		var html = '<div class="dataTables_processing" id="onProcess" style="z-index:5001">' + '<div  class="note-success" style="padding: 14px 15px;border-radius: 10px;display: flex;align-items: center;">' + '<img  style="top:-1px;display: inline-block; position:relative" src="/resource/front/images/forward/load.png" class="rotate"/>' + '<span style="font-size:14px;">' + msg + '</div>' + '</div>'
		div.innerHTML = html; //html
		document.getElementsByTagName('body')[0].append(div);
	}
</script>
<header class="mui-bar mui-bar-nav">
	<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
	<h1 class="mui-title">提现记录</h1>
</header>
<div class="content">
	<!--mui-navigate-right-->
	<div class="mui-card">
		<ul class="mui-table-view">
			<!--<li class="mui-table-view-cell mui-collapse mui-active">
				<a class=" header-con mui-navigate-right" href="#">
					<span id="">
							2018年5
						</span>
					<span id="">
							-4500LCB
						</span>
					<span id="">
							已到账：￥
							<span id="">
								45
							</span>
					</span>
				</a>
				<div class="mui-collapse-content">
					<div class="tx-info">
						提现详情
					</div>
					<div class="tx-list">
						<div class="tx-list-item">
							<span id="" class="time">
								5月30日 14:20
							</span>
							<span id="" class="money">
								-2000LCB
							</span>
							<span id="" class="getmoney error-m">
								已到账 ￥20
							</span>
						</div>
						<div class="tx-list-item">
							<span id="" class="time">
								5月30日 14:20
							</span>
							<span id="" class="money">
								-2000LCB
							</span>
							<span id="" class="getmoney">
								已到账 ￥20
							</span>
						</div>
						<div class="tx-list-item">
							<span id="" class="time">
								5月30日 14:20
							</span>
							<span id="" class="money">
								-2000LCB
							</span>
							<span id="" class="getmoney ">
								已到账 ￥20
							</span>
						</div>
					</div>
				</div>
			</li>-->
		</ul>
	</div>
</div>
{% include 'front/foot.html' %}
<script>
	mui.ready(function() {
		ykp.setLocalStorage('code', ykp.getUrlParam('uid'));
		this.init();

	});

	function init() {
		ykp.doAjax({
			url: "/api/appbanner/app_finance",
			method: "post",
			data: {
				uid:ykp.getLocalStorage('uid'),
				limit: 999,
				page: 1
			},
			success: function(res) {
				var data = res.data;
				if(data.length == 0){
					mui.toast("暂无提现记录")
					return false;
				}
				getContent(data)
			}
		})
	}

	function getContent(data) {
		var html = "";
		for(var i in data) {
			html += `<li class="mui-table-view-cell mui-collapse">
				<a class=" header-con mui-navigate-right" href="#">
					<span id="">
							${data[i].month}月
						</span>
					<span id="">
							-${data[i].z_tx}LCB
						</span>
					<span id="">
							已到账：￥
							<span id="">
								${data[i].z_dz}
							</span>
					</span>
				</a>
				<div class="mui-collapse-content">
					<div class="tx-info">
						提现详情
					</div>
					<div class="tx-list">
						${getList(data[i].child)}
					</div>
				</div>
			</li>`;
		}
		console.log(html);
		$('.mui-table-view').html(html);
	}

	function getList(list) {
		var listHt = "";
		for(var i in list) {
			listHt += `<div class="tx-list-item">
							<span id="" class="time">
								${getNowTime(list[i].create_time,true)}
							</span>
							<span id="" class="money">
								-${list[i].coin}LCB
							</span>
							<span id="" class="getmoney ${list[i].withdraw_status == 1 ?'' : 'error-m'} ">
								${list[i].withdraw_status == 1 ?'已到账' : '未到账'} ￥${list[i].withdraw_money}
							</span>
						</div>`;
		}
		return listHt;
	}

	function getNowTime(time, statu) {
		if(!time || time == 0) {
			return "";
		}
		var time = new Date(time * 1000),
			year = time.getFullYear(),
			month = this.fixZero(time.getMonth() + 1, 2),
			day = this.fixZero(time.getDate(), 2),
			hour = this.fixZero(time.getHours(), 2),
			minute = this.fixZero(time.getMinutes(), 2),
			second = this.fixZero(time.getSeconds(), 2);

		//		time = year + "-" + month + "-" + day + " " + hour + ":" + minute + ":" + second;
		if(statu) {
			time = +month + "月" + day + "日  " + hour + ":" + minute;
		} else {
			time = year + "-" + month + "-" + day;
		}
		return time;
	}

	function fixZero(num, length) {
		var str = "" + num,
			len = str.length,
			s = "";
		for(var i = length; i-- > len;) {
			s += "0";
		}
		return s + str;
	}

//	$('#back').click(function() {
//		if(mui.os.ios || (mui.os.android && parseFloat(mui.os.version) < 4.4)) {
//			goback();
//		} else {
//			window.android.back();
//		}
//	})
</script>